/*
 * 
 * Last modified: Koh Li
 */


package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

@Entity(name="Stakeholder")
public class StakeholderEntity implements Serializable {

    private static long serialVersionUID = 1L;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public static void setSerialVersionUID(long aSerialVersionUID) {
        serialVersionUID = aSerialVersionUID;
    }
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String username;
    private String password;
    private String corpName;
    private String bizRegNumber;
    private String corpContactNumber;
    private String corpContactPerson;
    private String corpEmail;
    private String corpFaxNumber;
    private int billingDay;
    private String shortDesc; 
    
    private String stakeholderDesc;
    private String imgUrl;
    
    
    @ManyToOne
    private IndustryTypeEntity industry;
    
    //@OneToOne
    //private IndustryTypeEntity industryType;
    
    @OneToOne
    private AddressEntity address;
    
    @OneToMany(cascade = {CascadeType.ALL}, mappedBy = "stakeholder")
    private List<PortalDescriptionLocale> descLocale = new ArrayList<PortalDescriptionLocale>();
    
    private Boolean activate = false;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date loginTime;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date creationDate;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date loginOutTime;
    @OneToMany(mappedBy = "stakeholder")
    private List<BranchEntity> branches = new ArrayList<BranchEntity>();
    
    @OneToMany(mappedBy = "stakeholder")
    private List<MediaEntity> media = new ArrayList<MediaEntity>();
    
    @OneToMany(mappedBy = "stakeholder")
    private List<AdvertisingEntity> advertisment = new ArrayList<AdvertisingEntity>();
    
    @OneToOne
    private UnstructuredContentEntity unstructuredContent;
    
    //T32
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateRegistered;
    @OneToMany(mappedBy = "stakeholder")
    private List<PaymentManagementEntity> paymentManagement = new ArrayList<PaymentManagementEntity>();
    @OneToMany(mappedBy = "stakeholder")
    private List<PaymentItemEntity> paymentItem = new ArrayList<PaymentItemEntity>();
    @OneToMany(mappedBy = "stakeholder")
    private List<ChosenMetricEntity> chosenMetrics = new ArrayList<ChosenMetricEntity>();
    @OneToMany(mappedBy="stakeholder")
    private List<TransactionsEntity> transaction= new ArrayList<TransactionsEntity>();
    //Added by Cong Dat
    @OneToMany(mappedBy = "stakeholder")
    private List<GrouponEntity> groupons = new ArrayList<GrouponEntity>();
        @OneToMany(mappedBy = "stakeholder")
    private List<RedemptionListEntity> redemptionList = new ArrayList<RedemptionListEntity>();

    public StakeholderEntity() {
    }

    public StakeholderEntity(StakeholderEntity stakeholder) {
        this.username = stakeholder.getUsername();
        this.password = stakeholder.getPassword();
        this.corpName = stakeholder.getCorpName();
        this.corpContactNumber = stakeholder.getCorpContactNumber();
        this.corpContactPerson = stakeholder.getCorpContactPerson();
        this.corpEmail = stakeholder.getCorpEmail();
        this.corpFaxNumber = stakeholder.getCorpFaxNumber();
        this.bizRegNumber = stakeholder.getBizRegNumber();
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getId() != null ? getId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StakeholderEntity)) {
            return false;
        }
        StakeholderEntity other = (StakeholderEntity) object;
        if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getCorpName() {
        return corpName;
    }

    public void setCorpName(String corpName) {
        this.corpName = corpName;
    }

    public String getBizRegNumber() {
        return bizRegNumber;
    }

    public void setBizRegNumber(String bizRegNumber) {
        this.bizRegNumber = bizRegNumber;
    }

    public String getCorpContactNumber() {
        return corpContactNumber;
    }

    public void setCorpContactNumber(String corpContactNumber) {
        this.corpContactNumber = corpContactNumber;
    }

    public String getCorpContactPerson() {
        return corpContactPerson;
    }

    public void setCorpContactPerson(String corpContactPerson) {
        this.corpContactPerson = corpContactPerson;
    }

    public String getCorpEmail() {
        return corpEmail;
    }

    public void setCorpEmail(String corpEmail) {
        this.corpEmail = corpEmail;
    }

    public String getCorpFaxNumber() {
        return corpFaxNumber;
    }

    public void setCorpFaxNumber(String corpFaxNumber) {
        this.corpFaxNumber = corpFaxNumber;
    }

    public int getBillingDay() {
        return billingDay;
    }

    public void setBillingDay(int billingDay) {
        this.billingDay = billingDay;
    }

    public String getShortDesc() {
        return shortDesc;
    }

    public void setShortDesc(String shortDesc) {
        this.shortDesc = shortDesc;
    }

    public String getStakeholderDesc() {
        return stakeholderDesc;
    }

    public void setStakeholderDesc(String stakeholderDesc) {
        this.stakeholderDesc = stakeholderDesc;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public IndustryTypeEntity getIndustry() {
        return industry;
    }

    public void setIndustry(IndustryTypeEntity industry) {
        this.industry = industry;
    }

    public AddressEntity getAddress() {
        return address;
    }

    public void setAddress(AddressEntity address) {
        this.address = address;
    }

    public List<PortalDescriptionLocale> getDescLocale() {
        return descLocale;
    }

    public void setDescLocale(List<PortalDescriptionLocale> descLocale) {
        this.descLocale = descLocale;
    }

    public Boolean getActivate() {
        return activate;
    }

    public void setActivate(Boolean activate) {
        this.activate = activate;
    }

    public Date getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public Date getLoginOutTime() {
        return loginOutTime;
    }

    public void setLoginOutTime(Date loginOutTime) {
        this.loginOutTime = loginOutTime;
    }

    public List<BranchEntity> getBranches() {
        return branches;
    }

    public void setBranches(List<BranchEntity> branches) {
        this.branches = branches;
    }

    public List<MediaEntity> getMedia() {
        return media;
    }

    public void setMedia(List<MediaEntity> media) {
        this.media = media;
    }

    public List<AdvertisingEntity> getAdvertisment() {
        return advertisment;
    }

    public void setAdvertisment(List<AdvertisingEntity> advertisment) {
        this.advertisment = advertisment;
    }

    public UnstructuredContentEntity getUnstructuredContent() {
        return unstructuredContent;
    }

    public void setUnstructuredContent(UnstructuredContentEntity unstructuredContent) {
        this.unstructuredContent = unstructuredContent;
    }

    public List<PaymentManagementEntity> getPaymentManagement() {
        return paymentManagement;
    }

    public void setPaymentManagement(List<PaymentManagementEntity> paymentManagement) {
        this.paymentManagement = paymentManagement;
    }

    public List<PaymentItemEntity> getPaymentItem() {
        return paymentItem;
    }

    public void setPaymentItem(List<PaymentItemEntity> paymentItem) {
        this.paymentItem = paymentItem;
    }

    public List<ChosenMetricEntity> getChosenMetrics() {
        return chosenMetrics;
    }

    public void setChosenMetrics(List<ChosenMetricEntity> chosenMetrics) {
        this.chosenMetrics = chosenMetrics;
    }

    public List<TransactionsEntity> getTransaction() {
        return transaction;
    }

    public void setTransaction(List<TransactionsEntity> transaction) {
        this.transaction = transaction;
    }

    public List<GrouponEntity> getGroupons() {
        return groupons;
    }

    public void setGroupons(List<GrouponEntity> groupons) {
        this.groupons = groupons;
    }

    public List<RedemptionListEntity> getRedemptionList() {
        return redemptionList;
    }

    public void setRedemptionList(List<RedemptionListEntity> redemptionList) {
        this.redemptionList = redemptionList;
    }

    public Date getDateRegistered() {
        return dateRegistered;
    }

    public void setDateRegistered(Date dateRegistered) {
        this.dateRegistered = dateRegistered;
    }

    

}